UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TqTCcts8FxnzNXCLvivRfI9CKFTXn6LV/izarHU6TWo=' 
WHERE 
  key_id = '5deacc09dec272151aceb30525a8193631eb61ee666f7339637f50f64d44aba3' 
  AND (
    token = 'TqTCcts8FxnzNXCLvivRfI9CKFTXn6LV/izarHU6TWo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029