UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PI+D3LSZd8pUF/47mHY1VR1CPYcUPrMc7BWsPEIA01w=' 
WHERE 
  key_id = '5bfa091afb374f69b142a46074fa8d23a1bac814d50f84adf645399a7ef6062a' 
  AND (
    token = 'PI+D3LSZd8pUF/47mHY1VR1CPYcUPrMc7BWsPEIA01w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032