UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7qV7e+DUlTKp5J1ZNPmKZenElwx6AsBFticLKp/IVaM=' 
WHERE 
  key_id = '77bc17786fbada8e71875e6df2413c42e887bdfcd2f2088d922827d911ff651c' 
  AND (
    token = '7qV7e+DUlTKp5J1ZNPmKZenElwx6AsBFticLKp/IVaM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031