UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gg6dU0VOD9edJ6akR585CuJCS08gsR5DiPMVw2y5Bxc=' 
WHERE 
  key_id = '6437a3418da193285af7bf03d289c00cb469519432ca81e4442bffb796742837' 
  AND (
    token = 'gg6dU0VOD9edJ6akR585CuJCS08gsR5DiPMVw2y5Bxc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025