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

Query time 0.00048