UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SehUdTWiIMg1ahS1BAaeUw1Hv2SujmjW8fBBQSgqhvw=' 
WHERE 
  key_id = '886574fc741df3ab3c5bf8e69c70fa8b7554d2b31c8183dfb0a96c8498fd7499' 
  AND (
    token = 'SehUdTWiIMg1ahS1BAaeUw1Hv2SujmjW8fBBQSgqhvw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031