UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k6vaE0JxhW/f7s/7XiJ+12+PD9eEuJFuWEH2epO671A=' 
WHERE 
  key_id = '956c1422f538f419019cec4a7762109d66de03db962dfa9e68e380935df2524d' 
  AND (
    token = 'k6vaE0JxhW/f7s/7XiJ+12+PD9eEuJFuWEH2epO671A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036