UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9HAbi2W4vx4AGhUQawwctg+RZPnOD2ZVVf0TAE0O/mg=' 
WHERE 
  key_id = 'c35ac2c189ebff5fe1a722a16a4e6d61d3a3771c2b96d36f8b25bc8212eb590a' 
  AND (
    token = '9HAbi2W4vx4AGhUQawwctg+RZPnOD2ZVVf0TAE0O/mg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032