UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UTvwUNY9jMSs682pMgD9yCfQmpwh+tYOC8y7mBYclq4=' 
WHERE 
  key_id = '3ade92f4281b19515f13e18268bfd5ce58aa76e99a503d58c65082c9a77a944b' 
  AND (
    token = 'UTvwUNY9jMSs682pMgD9yCfQmpwh+tYOC8y7mBYclq4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030