UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CfZTC31PNIwDt275aGBMo1Vk1WUS52TsFrCtfGVQmII=' 
WHERE 
  key_id = 'c872a74240c85ca65bd715edf27e03c0f97331d65648cc175b2a29774933d55a' 
  AND (
    token = 'CfZTC31PNIwDt275aGBMo1Vk1WUS52TsFrCtfGVQmII=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023