UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bh99+eaf0oNDyABOtz39CRtDC8Dn+Wi84IhOfi1ASGs=' 
WHERE 
  key_id = 'e7fac0cd1a5e7084d0419c4115a7a57ecb92c91c968f679576e07f05cf18463f' 
  AND (
    token = 'Bh99+eaf0oNDyABOtz39CRtDC8Dn+Wi84IhOfi1ASGs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039