UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G7dp637up4LcO/dMQHih5c3dhzMzFUKKCxhDpY1Uuyw=' 
WHERE 
  key_id = '0fd7785c377d678385cc69902111c5ba7704ea0cca990ea8460960726936785b' 
  AND (
    token = 'G7dp637up4LcO/dMQHih5c3dhzMzFUKKCxhDpY1Uuyw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028