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

Query time 0.00038