UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k5+wn42eWO5Pm0oQeZRi2a9KiC2MJ3/MF20IS2pkHpM=' 
WHERE 
  key_id = '74cb8107d251c1dfe4721073320f9f6f2aa1b16567adeef70f481613b0a2e98b' 
  AND (
    token = 'k5+wn42eWO5Pm0oQeZRi2a9KiC2MJ3/MF20IS2pkHpM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022