UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RPW3OwoAPGzVL5L/4YeqcHfs0NU0jVm0Gp5SnoVKtug=' 
WHERE 
  key_id = '35774a5a8ba7a45c281edd81ab266e72d4a801c2aa83c2150476327ae0114c34' 
  AND (
    token = 'RPW3OwoAPGzVL5L/4YeqcHfs0NU0jVm0Gp5SnoVKtug=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054