UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GB9EE5y451SWdlcIqS+RJwMdQYewoQBl+92dOvwbjqQ=' 
WHERE 
  key_id = '77cd3ef19f87287a6cb258aeaf61b3978da6e6f0e34ed1a881723b4f2abfe3b0' 
  AND (
    token = 'GB9EE5y451SWdlcIqS+RJwMdQYewoQBl+92dOvwbjqQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032