UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q+sGuLPzcbA2NFUNpI42Qu3QRTNJl8U0JUaaTD4oxA0=' 
WHERE 
  key_id = '38935d206cf7cf1d6f42e80efd9e6604f588743ed9f9150456036aec0fc3e7dd' 
  AND (
    token = 'Q+sGuLPzcbA2NFUNpI42Qu3QRTNJl8U0JUaaTD4oxA0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027