UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W9azxcDogPlmGBVJbwQN//+tCq+O/UbYh42oT5Bsx0g=' 
WHERE 
  key_id = '38917cb4665e8595eac72a977d8eda649d556a9c75a17a020e78ea296a184036' 
  AND (
    token = 'W9azxcDogPlmGBVJbwQN//+tCq+O/UbYh42oT5Bsx0g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022