UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nM6cgz+W7GOGI11g+fjcVz70FWRUPTktTgLW//D8sHE=' 
WHERE 
  key_id = 'cee2b6b1bd3587948af9eda666ae43ee6a4b3b4027b3d31c4a9c1485c3612597' 
  AND (
    token = 'nM6cgz+W7GOGI11g+fjcVz70FWRUPTktTgLW//D8sHE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060