UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RpkD0mZii6L21cbk7IjMjKUO3nFZApN3vhgZIN7BUjM=' 
WHERE 
  key_id = '49f9a03abd662435c5ef31d8ac398654088ed3282c6bbba04ad5ff2ecacdcb1d' 
  AND (
    token = 'RpkD0mZii6L21cbk7IjMjKUO3nFZApN3vhgZIN7BUjM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034