UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZfO7Ym1D/0XrnPC8qlSm7vT2T9WPOoW5X3ayhG4fYoo=' 
WHERE 
  key_id = '6696acebb57962c7b0f83be194d732237122035cdf5c88d9e565f04fcf5a70c1' 
  AND (
    token = 'ZfO7Ym1D/0XrnPC8qlSm7vT2T9WPOoW5X3ayhG4fYoo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016