UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B8HXqowgfQc+DM0NiUbexNWy9ETiFwKhtyPWl7t1Vos=' 
WHERE 
  key_id = '4fbde4ddae08c2e8668a7d9c1e4267d9978e7bb72d2e664dc87b407082bfb007' 
  AND (
    token = 'B8HXqowgfQc+DM0NiUbexNWy9ETiFwKhtyPWl7t1Vos=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024