UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6rfZS8PChD0fP13D6i6d4KkpD63YMm6IV1/YGKg1zHI=' 
WHERE 
  key_id = '2c6783ade3d3f85e07c6ba9ac868e869716e72668041d30a2db6fce5bd844b7f' 
  AND (
    token = '6rfZS8PChD0fP13D6i6d4KkpD63YMm6IV1/YGKg1zHI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028