UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5GCPQiqEXD4rudQ7HK195K+ZCsQMobY+slUnBm2fMpU=' 
WHERE 
  key_id = '4535f21485fcd0d0a4a6a3cab86a66b41a7e773a6481b9e1abdb38bde8d0a67f' 
  AND (
    token = '5GCPQiqEXD4rudQ7HK195K+ZCsQMobY+slUnBm2fMpU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042