UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F8sCTkzmyRD7nLui4j/iW4wQMEOnHHF5eB487x5eEjE=' 
WHERE 
  key_id = '2511db4ad4953f2a12d2f17b98ae05925823745f8885e795bf2cb7a0df730672' 
  AND (
    token = 'F8sCTkzmyRD7nLui4j/iW4wQMEOnHHF5eB487x5eEjE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029