UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S0o4eGJtSZkbHtQ/3/P5DviHnz2goHATJ0ROYjDMh+M=' 
WHERE 
  key_id = '04f8e18376797d1bf848404c87c3f709ada5ab8c67ae4ca2dfe9653241a7a670' 
  AND (
    token = 'S0o4eGJtSZkbHtQ/3/P5DviHnz2goHATJ0ROYjDMh+M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032