UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GHnkgJ+HoGJPwRpaK9d403x95TPgImHg3eG+LOI7Ifs=' 
WHERE 
  key_id = '7ec56ffc3a9b6a57d397338b2c2b16a6d577318481d46baf5ec33b3840192705' 
  AND (
    token = 'GHnkgJ+HoGJPwRpaK9d403x95TPgImHg3eG+LOI7Ifs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028