UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6KqDePSUwh2yXX7M0FJa+TwZoBOtrDsjuAg33OXCE1M=' 
WHERE 
  key_id = 'c63604e3897e483aa750dda64c11b34ca268bc277168e6f8a8d30f64695b2c5c' 
  AND (
    token = '6KqDePSUwh2yXX7M0FJa+TwZoBOtrDsjuAg33OXCE1M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032