UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2SQZnC3UwhkjB0i8F75bKxpA43C31DNKfP32sQG4wSc=' 
WHERE 
  key_id = '261caf978c8ebaf69b6f901a00525477c30ac10bbfdb7e600c83c5fad10f23ce' 
  AND (
    token = '2SQZnC3UwhkjB0i8F75bKxpA43C31DNKfP32sQG4wSc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032