UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm0o9NOzmuox28tMteh0RsBEUcs5P5Xn4scbvOcAxF2w=' 
WHERE 
  key_id = '6f7f92dd6d29cbe5992bdaa7e08aa61aa3a3a176f178db5c997886f551164bb4' 
  AND (
    token = 'm0o9NOzmuox28tMteh0RsBEUcs5P5Xn4scbvOcAxF2w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032