UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jrZ027HoXJmFSRkLPJy7ecquKmss0vqQGQGryYfxeBs=' 
WHERE 
  key_id = 'c05658425fd96df91acdeff4eb7f8f1c6cc64bb5b924fd93d4812b603c170372' 
  AND (
    token = 'jrZ027HoXJmFSRkLPJy7ecquKmss0vqQGQGryYfxeBs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042