UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e6/NUpsi+nhsuAujaVTp6O4t8lxYTL564WmBYyMt2sM=' 
WHERE 
  key_id = 'b7e14f4bba124b4f105d975e9919568d15252119bc0ff0924dc65c858b95e350' 
  AND (
    token = 'e6/NUpsi+nhsuAujaVTp6O4t8lxYTL564WmBYyMt2sM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035