UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ogQAsF9Kc9FHCOHMQ3NDh1Tfh0dbmopcU0Ob+qv9jms=' 
WHERE 
  key_id = '0341945499b1578ca2422a4a8a1c4900d54781e7f2ce11759cee239226a2ea75' 
  AND (
    token = 'ogQAsF9Kc9FHCOHMQ3NDh1Tfh0dbmopcU0Ob+qv9jms=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036