UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 's0oawtvHu9rinkDhif+dbx9k3aQ9B3kC45VZW6QCMkU=' 
WHERE 
  key_id = '846031860c7e01a8b5037fda95455d3a4370de80e329a4e2b18fb5e9a57217ba' 
  AND (
    token = 's0oawtvHu9rinkDhif+dbx9k3aQ9B3kC45VZW6QCMkU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032