UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K2oS1zAOrf3ZfbMCDaAfIJel9UG8VJ8XCSyzSlnhj8M=' 
WHERE 
  key_id = '41af03377f02381182400699fc467ecefaba7f457f54180024d117a1dd03054a' 
  AND (
    token = 'K2oS1zAOrf3ZfbMCDaAfIJel9UG8VJ8XCSyzSlnhj8M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049