UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '99ms5GSdC0z5+5oEXvhM0e3k9KS0VCzRozrMjvcjLY0=' 
WHERE 
  key_id = '3dce1ea409d203e1212b924c15f6a4b06f66b7df27cc8829d4a7907e88ec660f' 
  AND (
    token = '99ms5GSdC0z5+5oEXvhM0e3k9KS0VCzRozrMjvcjLY0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041