UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ifqHCaraXFf291u0Val/T/APUVfrFvAdSyWtgTkd79c=' 
WHERE 
  key_id = 'c1ddcd5189b2579d94e3b5a76fd8f30c7f86991d3873edac1bf348a4a88b4a24' 
  AND (
    token = 'ifqHCaraXFf291u0Val/T/APUVfrFvAdSyWtgTkd79c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027