UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lvgBa1F5Hd9EBkH2azjIPnLyvwPWJ7UC1TKdaKu8t+A=' 
WHERE 
  key_id = '3417a4d5f0aa671791f48d14a7af7c210fdc767d69b914c5ce8b36566ffb145c' 
  AND (
    token = 'lvgBa1F5Hd9EBkH2azjIPnLyvwPWJ7UC1TKdaKu8t+A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047